package com.javastudy.autowiredStudy.springmvcIntercepter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * spring全局拦截器
 * @author mac
 * @date 2021/9/7 4:09 下午
 */
public class AddMvcIntercepterToIOC extends WebMvcConfigurerAdapter {
    @Autowired
    private MVCIntercepter mvcIntercepter;

    /**
     * 将mvc的拦截器注册到spring的拦截器中
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(mvcIntercepter);
    }
}
